//
//  LFYTestViewController.m
//  loanForYou
//
//  Created by 刘威 on 2017/5/16.
//  Copyright © 2017年 刘威. All rights reserved.
//

#import "LFYTestViewController.h"

@interface LFYTestViewController ()

@property (strong, nonatomic) UIScrollView *scrollView;

@end

@implementation LFYTestViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = _topTitle;
    [self createNavigationBackItem];
    _scrollView = [[UIScrollView alloc] init];
    _scrollView.backgroundColor = [UIColor grayBackgroundColor];
    [self.view addSubview:_scrollView];
    [_scrollView makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.bottom.mas_equalTo(self.view);
    }];
    _scrollView.alwaysBounceVertical = YES;
    _scrollView.showsVerticalScrollIndicator = NO;
    _scrollView.showsHorizontalScrollIndicator = NO;
//    UILabel *titleLabel = [[UILabel alloc] init];
//    titleLabel.numberOfLines = 0;
//    titleLabel.textColor = [UIColor grayTitleColor];
//    titleLabel.font = [UIFont nameFont];
//    [_scrollView addSubview:titleLabel];
//    [titleLabel makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(_scrollView.mas_left).offset(15);
////        make.right.equalTo(_scrollView.mas_right).offset(-15);
//        make.width.equalTo(@(SCREEN_WIDTH - 30));
//        make.top.equalTo(_scrollView.mas_top).offset(20);
//    }];
//    
//    titleLabel.text = _topTitle;
    
    UILabel *contentLabel = [[UILabel alloc] init];
    contentLabel.numberOfLines = 0;
    contentLabel.textColor = [UIColor grayContentColor];
    contentLabel.font = [UIFont contentFont];
    [_scrollView addSubview:contentLabel];
    [contentLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_scrollView.mas_left).offset(15);
//        make.right.equalTo(_scrollView.mas_right).offset(-15);
        make.width.equalTo(@(SCREEN_WIDTH - 30));
        make.top.equalTo(_scrollView.mas_top).offset(20);
    }];
    
    contentLabel.text = _content;

    CGSize size = [Tool getSize:_content withFount:[UIFont contentFont] withW:SCREEN_WIDTH - 30 withH:0];
    [_scrollView setContentSize:CGSizeMake(SCREEN_WIDTH, size.height + 40)];
    // Do any additional setup after loading the view.
}

- (void)actionBack:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)setContent:(NSString *)content {
    _content = content;
}

- (void)setNavTitle:(NSString *)navTitle {
    _navTitle = navTitle;
}

- (void)setTopTitle:(NSString *)topTitle {
    _topTitle = topTitle;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
